package com.daqian.chance.example.admin.modules.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqian.chance.example.admin.modules.system.mapper.SysMenuMapper;
import com.daqian.chance.example.admin.modules.system.po.dto.SysMenuDTO;
import com.daqian.chance.example.admin.modules.system.po.entity.SysMenu;
import com.daqian.chance.example.admin.modules.system.service.ISysMenuService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统-菜单表 服务实现类
 * </p>
 * @author daqian
 * @since 2019-08-08
 */
@Service
@Slf4j
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
    @Override
    public PageInfo<SysMenu> page(SysMenuDTO sysMenuDTO) {
        // 开启分页
        PageHelper.startPage(sysMenuDTO.getPageNum(), sysMenuDTO.getPageSize());
        List<SysMenu> sysMenuList = super.list(null);
        // 清除分页
        PageHelper.clearPage();
        return new PageInfo<>(sysMenuList);
    }

    /**
     * 根据角色id查询角色菜单
     * @param roleId
     * @return
     */
    @Override
    public List<SysMenu> selectMenusByRoleId(Long roleId) {

        return null;
    }
}
